package top.aicey.ai.sparring.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.aicey.ai.sparring.common.holder.CurrentUser;
import top.aicey.ai.sparring.common.holder.UserHolder;
import top.aicey.ai.sparring.common.utils.BaseResponseUtil;
import top.aicey.ai.sparring.dto.model.BaseResponse;
import top.aicey.ai.sparring.dto.res.SceneResponse;
import top.aicey.ai.sparring.service.ISceneService;

/**
 * <p>
 * 企业场景信息 前端控制器
 * </p>
 *
 * @author 白杨
 * @since 2024-12-19
 */
@Api(tags = "AI陪练学员端接口")
@RestController
@RequestMapping("/v3/sparing/trainingScene")
public class TrainingSceneController {


    @Autowired
    private ISceneService sceneService;

    @ApiOperation(value = "学员端列表")
    @PostMapping(value = "/list")
    public BaseResponse<PageInfo<SceneResponse>> list(
            @RequestParam(value = "pageNumber", defaultValue = "1", required = false) Integer pageNumber,
            @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize
    ){

        CurrentUser user = UserHolder.getUser();

        // 读取企业id
        String moduleId = user.getModuleId();

        PageInfo<SceneResponse> page = sceneService.pageQuery(pageNumber,pageSize,moduleId);
        return BaseResponseUtil.buildSuccessResponse(page);
    }

}
